#ifndef TREEITERATOR_H
#define TREEITERATOR_H

#include <list>
#include <stack>

#include "bga/system/Iterator.h"

/**
 * \namespace bga
 * \brief API namespace
 */
namespace bga
{

/*!
 * \class TreeIterator
 * \brief
 *
 *
 */
template< typename T >
class DepthFirstTreeIterator : public Iterator<T>
{
    typedef typename std::list< Scoped_Ptr< Node<T> > >::const_iterator listIterator;

    public:
        DepthFirstTreeIterator(const Node<T>& node);
        ~DepthFirstTreeIterator();

        virtual bool hasNext();
        virtual T* next();

    protected:
        const Node<T>* root;
        listIterator currentIterator;

    private:
        void goNext();

        std::stack< listIterator > stackIterator;
        bool begin;

};

}

#include "bga/system/DepthFirstTreeIterator.inl"

#endif // TREEITERATOR_H

